﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCompanyName.AbpZeroTemplate.Daybooks
{
    using Abp.Domain.Entities;
    using Abp.Domain.Entities.Auditing;

    /// <summary>
    /// 日报 聚合根，需要记录审核日志，可能含有租户
    /// </summary>
    public class Daybook : FullAuditedEntity<long>, IMayHaveTenant
    {
        public Daybook() { }
        public Daybook(long accountId, DateTime bookDate)
        {
            this.AccountId = accountId;
            this.BookDay = bookDate;
        }
        /// <summary>
        /// 日报所属的用户
        /// </summary>
        [System.ComponentModel.DataAnnotations.Required]
        //[System.ComponentModel.DataAnnotations.Schema.Index("ab", 2, IsUnique = true)]
        public long AccountId { get; set; }

        /// <summary>
        /// 冗余的用户显示名
        /// </summary>
        public string AccountName { get; set; }

        /// <summary>
        /// 日报所属的日期
        /// </summary>
        [System.ComponentModel.DataAnnotations.Required]
        //[System.ComponentModel.DataAnnotations.Schema.Index("ab", 1, IsUnique = true)]
        public DateTime BookDay { get; set; }

        /// <summary>
        /// 日报的备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 缺勤 在岗 出差 外出 请假 休息
        /// </summary>
        public string Category { get; set; }

        /// <summary>
        /// 日报内的明细
        /// </summary>
        [System.ComponentModel.DataAnnotations.Schema.ForeignKey("DaybookId")]
        public virtual ICollection<DaybookItem> Items { get; set; }

        public virtual int? TenantId { get; set; }

    }
}
